import request from '@/utils/request'

/**
 * 商家信息相关
 */
export function getBusinessInfo() {
  return request({
    url: '/business_admin/base/info',
    method: 'get',
    params: {}
  })
}

export function updateBusiness(data) {
  return request({
    url: '/business_admin/base/update',
    method: 'post',
    data: data
  })
}

/**
 * 商家产品相关
 */
// 获取商家产品功能列表
export function getFeatureList(params) {
  return request({
    url: '/business_admin/feature/list',
    method: 'get',
    params: params
  })
}

// 保存商家产品功能列表
export function saveFeatureConfig(data) {
  return request({
    url: '/business_admin/feature/config',
    method: 'post',
    data: data
  })
}

/**
 * 商家终端相关
 */
// 获取设备授权码
export function activeDeviceCode(params) {
  return request({
    url: '/business_admin/device/status/active_code',
    method: 'get',
    params: params
  })
}

// 刷新设备授权码
export function refreshActiveDeviceCode(data) {
  return request({
    url: '/business_admin/device/status/refresh_active_code',
    method: 'post',
    data: data
  })
}

// 终端用户登出
export function logoutDevice(data) {
  return request({
    url: '/business_admin/device/status/logout',
    method: 'post',
    data: data
  })
}

// 终端设备解绑
export function unbindDevice(data) {
  return request({
    url: '/business_admin/device/status/unbind',
    method: 'post',
    data: data
  })
}

// 获取终端列表
export function listDevice(data) {
  return request({
    url: '/business_admin/device/list',
    method: 'post',
    data: data
  })
}

// 创建终端
export function addDevice(data) {
  return request({
    url: '/business_admin/device/add',
    method: 'post',
    data: data
  })
}

// 更新终端信息
export function updateDevice(data) {
  return request({
    url: '/business_admin/device/update',
    method: 'post',
    data: data
  })
}

// 更新终端状态
export function updateDeviceState(data) {
  return request({
    url: '/business_admin/device/change_status',
    method: 'post',
    data: data
  })
}

// 获取所有设备
export function getAllDeviceList() {
  return request({
    url: '/business_admin/device/all',
    method: 'post'
  })
}

// 获取门店下的所有设备
export function getAllDeviceListByShopId(params) {
  return request({
    url: '/business_admin/device/shop_all',
    method: 'post',
    params: params
  })
}
// 免登陆跳转平台
export function checkPageJumpTo(params) {
  return request({
    url: '/business_admin/user/checkPageJumpTo',
    method: 'post',
    params: params
  })
}
// 获取享扫平台登录地址
export function pay_platform_login(params) {
  return request({
    url: '/uaa/manage/login/pay_platform_login',
    method: 'get',
    params: params
  })
}

// 流量预警
export function flowAlert(params) {
  return request({
    url: '/business_admin/flow/flowAlert',
    method: 'get',
    params: params
  })
}
// 获取当前套餐和流量余额
export function getPackageAndBalance(params) {
  return request({
    url: '/business_admin/flow/getPackageAndBalance',
    method: 'get',
    params
  })
}
// 叠加套餐列表接口
export function mercPkgOverLayInfo(params) {
  return request({
    url: '/business_admin/enjoyFavour/mercPkgOverLayInfo',
    method: 'get',
    params
  })
}
// 商户流量余额记录
export function merchantFlowRecordList(data) {
  return request({
    url: '/business_admin/flow/merchantFlowRecordList',
    method: 'post',
    data
  })
}
// 我的套餐余量
export function myPackageFlowList(data) {
  return request({
    url: '/business_admin/flow/myPackageFlowList',
    method: 'post',
    data
  })
}
// 导出商户流量余额记录
export function exportMerchantFlows(data) {
  return request({
    url: '/statistics_admin/task/export_merchant_flows',
    method: 'post',
    data
  })
}
// 导出我的流量余额
export function exportMyPackage(data) {
  return request({
    url: '/statistics_admin/task/export_my_package',
    method: 'post',
    data
  })
}

/* 超级会员相关接口 */
// 查询商户插件状态

export function querySuperMemberStatus(data) {
  return request({
    url: '/business_admin/superMember/querySuperMemberStatus',
    method: 'get',
    data: data
  })
}
// 超级会员邀请者

// 邀请商户

export function addBusinessToMember(data) {
  return request({
    url: '/business_admin/superMember/addBusinessToMember',
    method: 'post',
    data: data
  })
}

export function newInviteBusiness(data) {
  return request({
    url: '/business_admin/superMember/newInviteBusiness',
    method: 'post',
    data: data
  })
}
// 邀请记录

export function inviteRecord(data) {
  return request({
    url: '/business_admin/superMember/inviter/queryInviteRecord',
    method: 'post',
    data: data
  })
}
// 修改记录

export function queryModifyRecord(data) {
  return request({
    url: '/business_admin/superMember/queryModifyRecord',
    method: 'post',
    data: data
  })
}
// 邀请商家抽佣比例配置

export function getSuperMemberRateConfig(data) {
  return request({
    url: '/business_admin/superMember/getSuperMemberRateConfig',
    method: 'post',
    data: data
  })
}
// 搜索商户

// export function searchBusiness(data) {

// 	return request({

// 		url: '/business_admin/superMember/searchBusiness',

// 		method: 'post',

// 		data: data

// 	})

// }

export function searchBusinessByPhone(data) {
  return request({
    url:
      '/business_admin/superMember/searchBusinessByPhone?mobilePhone=' +
      data.mobilePhone,
    method: 'get'
  })
}
// 合作、退出记录

export function queryCooperationRecord(data) {
  return request({
    url: '/business_admin/superMember/queryCooperationRecord',
    method: 'post',
    data: data
  })
}
// 邀请者修改佣金折扣

export function modifyDiscountAndRakeRate(data) {
  return request({
    url: '/business_admin/superMember/modifyDiscountAndRakeRate',
    method: 'post',
    data: data
  })
}
// 邀请者取消合作

export function cancelCooperation(data) {
  return request({
    url: '/business_admin/superMember/inviter/cancelCooperation',
    method: 'get',
    params: data
  })
}
// 合作商家的订单

export function queryMemberOrder(data) {
  return request({
    url: '/business_admin/superMember/queryMemberOrder',
    method: 'post',
    data: data
  })
}
// 邀请者补贴记录接口

export function queryInviterSubsidyOrder(data) {
  return request({
    url: '/business_admin/superMember/queryInviterSubsidyOrder',
    method: 'post',
    data: data
  })
}
// 补贴账户余额

export function getSubsidyAccountBalance(data) {
  return request({
    url:
      '/business_admin/channelAccount/getSubsidyAccountBalance?businessId=' +
      data.businessId,
    method: 'get',
    data: data
  })
}

export function isOpenSubsidyAccount() {
  return request({
    url: 'business_admin/superMember/isOpenSubsidyAccount',
    method: 'get'
  })
}

// 邀请者补贴详情

export function queryInviterSubsidyDetail(data) {
  return request({
    url: '/business_admin/superMember/queryInviterSubsidyDetail',
    method: 'post',
    data: data
  })
}
// 检查补贴绑定关系接口

export function checkSubsidyRelation(data) {
  return request({
    url: '/business_admin/superMember/checkSubsidyRelation?joinBusinessId=' + data.joinBusinessId,
    method: 'get',
    data: data
  })
}
// 保存渠道营销户

export function saveMarketingAccount(data) {
  return request({
    url:
      '/business_admin/base/saveMarketingAccount?businessId=' +
      data.businessId +
      '&marketingAccount=' +
      data.marketingAccount,
    method: 'get',
    data: data
  })
}

// 超级会员参与者

// 被邀请记录

export function beInviteRecord(data) {
  return request({
    url: '/business_admin/superMember/participant/queryInviteRecord',
    method: 'post',
    data: data
  })
}
// 同意、拒绝加入

export function joinSuperMemberOperation(data) {
  return request({
    url: '/business_admin/superMember/participant/joinSuperMemberOperation',
    method: 'post',
    data: data
  })
}
// 同意，拒绝修改

export function handleModify(data) {
  return request({
    url: '/business_admin/superMember/handleModify',
    method: 'post',
    data: data
  })
}
// 合作记录

export function inviterQueryCooperationRecord(data) {
  return request({
    url: '/business_admin/superMember/inviterQueryCooperationRecord',
    method: 'post',
    data: data
  })
}
// 参与者获取合作商家的返佣订单列表

export function participantQueryMemberOrder(data) {
  return request({
    url:
      '/business_admin/superMember/participantQueryMemberOrder?businessId=' +
      data.businessId,
    method: 'post',
    data: data
  })
}
// 参与者查询超级会员订单补贴列表

export function queryOrderSubsidyDetails(data) {
  return request({
    url:
      '/business_admin/superMember/queryOrderSubsidyDetails?businessId=' +
      data.businessId,
    method: 'post',
    data: data
  })
}
// 参与者-查询可以报名的优惠券活动

export function activityAvailableQuery(data) {
  return request({
    url:
      '/couponAdmin/participant/coupon/activityAvailableQuery?businessId=' +
      data.businessId,
    method: 'post',
    data: data
  })
}
// 参与者-同意参与活动

export function participateIn(data) {
  return request({
    url:
      '/couponAdmin/participant/coupon/participateIn?couponActivityId=' +
      data.couponActivityId,
    method: 'get',
    data: data
  })
}
// 参与者-拒绝参与活动

export function refuse(data) {
  return request({
    url:
      '/couponAdmin/participant/coupon/refuse?couponActivityId=' +
      data.couponActivityId,
    method: 'get',
    data: data
  })
}
// 会员日获取合作商户接口

export function getCooperationBusiness(data) {
  return request({
    url: '/couponAdmin/memberDat/getCooperationBusiness',
    method: 'post',
    data: data
  })
}

// 同步云音响
export function syncManageSpeaker(data) {
  return request({
    url: '/scrm_printer_admin/manage/speaker/sync',
    method: 'post',
    data: data
  })
}
export function syncsManageSpeaker(data) {
  return request({
    url: '/scrm_printer_admin/manage/speaker/syncs',
    method: 'get',
    params: data
  })
}

// 同步云打印机
export function syncManagePrinter(data) {
  return request({
    url: '/scrm_printer_admin/manage/sync',
    method: 'post',
    data: data
  })
}

// 获取所有会员卡
export function getVipCardList(data) {
  return request({
    url: '/memberAdmin/memberCategory/listNotice',
    method: 'get',
    data: data
  })
}
// 新增或者编辑公告
export function addAndEditAffiche(data) {
  return request({
    url: '/memberAdmin/notice/saveOrUpdate',
    method: 'post',
    data: data
  })
}
// 获取公告列表
export function getAfficheList(data) {
  return request({
    url: '/memberAdmin/notice/page',
    method: 'post',
    data: data
  })
}
// 获取公告详情
export function getAfficheDetail(data) {
  return request({
    url: `/memberAdmin/notice/detail?id=${data.id}`,
    method: 'get',
    data: data
  })
}
// 删除公告
export function deleteAffiche(data) {
  return request({
    url: `/memberAdmin/notice/delete?id=${data.id}`,
    method: 'get',
    data: data
  })
}
// 修改序号
export function editOrderNum(data) {
  return request({
    url: `/memberAdmin/notice/updateOrderNum`,
    method: 'post',
    data: data
  })
}
// 修改公告状态
export function changeAfficheStatus(data) {
  return request({
    url: `/memberAdmin/notice/updateStatus`,
    method: 'post',
    data: data
  })
}

// 根据会员名称获取id
// export function getMemberIdByName(name, id) {
//   return request({
//     url: `/memberAdmin/member/getMemberIdByName?name=${name}`,
//     method: "get",
//   });
// }

// 获取合作商户店铺接口
export function getShopList(params) {
  return request({
    url: '/business_admin/superMember/shopList',
    method: 'get',
    params
  })
}
// 获取记录详情接口
export function inviteRecordId(params) {
  return request({
    url: '/business_admin/superMember/getBusinessInviteRecordDetail',
    method: 'get',
    params
  })
}
